<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<title>作用域</title>
</head>
<body>

	<script>

		/*function fn(a) {
            console.log(a); //function a() {};
            var a = 2;
            function a() {};
            ////////////////////////////////
            var a = function() {}; //如果没有这行18console.log(a)=>2
            console.log(a); //function() {};
        }

        fn(1);
        //a(); //a在作用域内，调不到报错。*/
//////////////////////////////////////////////////////////////////////////
        var length =20;
		function fn(){
			console.log(this.length);  // 20 3
		}
		
		var obj={
			length:10,
			method:function(fn){
				fn();
				arguments[0]();
			}
		};
		obj.method(fn,1,2)


	</script>
</body>
</html>
